package com.example.demo.util;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

/**
 * Created by zhangjiawen on 2019/5/21.
 */
public class JsonUtils {
          private static final ObjectMapper objectMapper=new ObjectMapper();

    /**
     * json字符串转jsonNode对象的方法
     */

        public static JsonNode str2JsonNode(String str){
            try {
                return objectMapper.readTree(str);
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }
}
